<?php
/*
array(3) {
  ["decorates"]=>
  array(5) {
    [0]=>
    string(10) "switchChar"
    [1]=>
    string(8) "loseChar"
    [2]=>
    string(10) "doubleChar"
    [3]=>
    string(13) "wwwPrefixChar"
    [4]=>
    string(11) "vPrefixChar"
  }
  ["domainName"]=>
  string(10) "domainName"
  ["type"]=>
  string(10) "typoDomain"
}
*/
require("Abstract.class.php");
class TypoDomain extends Domain
{
	private $_domainName;
	
	public function __construct($domainName) 
	{
		parent::__construct();
		$this->_domainName = $domainName;
	}
	
	public function switchChar() 
	{
		$result = array();
		for ($i=0; $i<strlen($this->_domainName)-1; $i++) {
			$domainName = $this->_domainName;
			$tmp = $domainName[$i];
			$domainName[$i] = $domainName[$i+1];
			$domainName[$i+1] = $tmp;
			$result[] = $domainName;
		}
		//return $result;
		return $this->addSuffixes($result);
	}
	
	public function loseChar()
	{
		$result = array();
		for ($i=0; $i<strlen($this->_domainName)-1; $i++) {
			$domainName = str_split($this->_domainName);
			unset($domainName[$i]);
			$result[] = implode('', $domainName);
		}
		//return $result;
		return $this->addSuffixes($result);
	}
	
	public function doubleChar()
	{
		$result = array();
		for ($i=0; $i<strlen($this->_domainName)-1; $i++) {
			$domainName = str_split($this->_domainName);
			$domainName[$i] = str_repeat($domainName[$i], 2);
			$result[] = implode('', $domainName);
		}
		//return $result;
		return $this->addSuffixes($result);
	}
	
	public function wwwPrefixChar()
	{
		return $this->addSuffixes('www'.$this->_domainName);
	}
	
	public function vPrefixChar()
	{
		return $this->addSuffixes('v'.$this->_domainName);
	}
}

?>